﻿using Microsoft.AspNetCore.Mvc;
using WMSUIMVC.DTO.Injure;
using WMSUIMVC.DTO.InventoryAlert;
using XuanKeZz.Application.HTTP;

namespace WMSUIMVC.Controllers
{
    public class InventoryAlerController : Controller
    {
        private readonly IConfiguration configuration;

        public InventoryAlerController(IConfiguration configuration)
        {
            this.configuration = configuration;
        }

        public IActionResult Index()
        {
            return View();
        }


        public IActionResult GetInventoryAler()
        {
            return View();
        }


        /// <summary>
        /// 显示库存预警的数据
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pindex"></param>
        /// <param name="psize"></param>
        /// <returns></returns>
        public async Task<IActionResult> GetInjureList(InventoryAlertDto obj)
        {
            HttpClientWrapper client = new HttpClientWrapper(obj.Token);
            string url = configuration["Url"] + "ckd/api/InventoryAlert/GetStoreList?ProductsCode=" + obj.ProductsCode + "&ProductsName=" + obj.ProductsName + "&WarehouseId=" + obj.WarehouseId + "&Pindex=" + obj.Pindex + "&Psize=" + obj.Psize;
            string res = await client.GetAsync(url);
            return Json(res);
        }

    }
}
